# Maintainer: Ainola <ainola@archlinux.org>
# Contributor: Drew DeVault

pkgname=scdoc
pkgver=1.11.2
pkgrel=5
license=('MIT')
pkgdesc='Tool for generating roff manual pages'
arch=('loong64' 'x86_64')
url='https://git.sr.ht/~sircmpwn/scdoc/'
source=("$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz")
sha512sums=('3fbf1a74b222dd88410636124e4b6ca73f7e77f67d512cf430a878fefcaa5c6c13a1e9f6c0c9654de15353f94bb1bd528665acebc2293bebb325501d1eb6cda3')

build() {
    cd "$pkgname-$pkgver"
    # Upstream purposefully does not honor the user's LDFLAGS in order to keep
    # scdoc static. As we gain no benefit to statically linking and, in fact,
    # lose standard Arch practices (such as RELRO and PIE), we must override
    # LDFLAGS
    make PREFIX=/usr LDFLAGS="$LDFLAGS"
}

check() {
    cd "$pkgname-$pkgver"
    make check
}

package() {
    cd "$pkgname-$pkgver"
    make PREFIX=/usr DESTDIR="$pkgdir" install
    install -Dm644 COPYING -t "$pkgdir/usr/share/licenses/$pkgname"
}
